<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- App favicon -->
    <link rel="shortcut icon" href="/assets/images/favicon.ico">

    <link href="/assets/plugins/jvectormap/jquery-jvectormap-2.0.2.css" rel="stylesheet">

    <!-- App css -->
    <link href="/assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="/assets/css/icons.css" rel="stylesheet" type="text/css" />
    <link href="/assets/css/metismenu.min.css" rel="stylesheet" type="text/css" />
    <link href="/assets/css/style.css" rel="stylesheet" type="text/css" />
    <!-- 引入vue cdn -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <!-- 引入axios cdn -->
    <script src="/app/vue/axios/axios.min.js"></script>
    <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
</head>

<body class="container_12">
    <div class="box round first" style="margin:15px;">
        <h2>数据列表</h2>
        <div class="block">
            <div>
            </div>
            <table id="example" class="data display datatable">
                <thead>
                    <tr>
                        <th>客房名称</th>
                        <th>预约人</th>
                        <th>电话</th>
                        <th>性别</th>
                        <th>身份证</th>
                        <th>价格</th>
                        <th>预约时间</th>
                        <th>状态</th>
                        <th style="width: 150px;">操作</th>
                    </tr>
                </thead>
                <tbody id="order_list_vue">
                    <tr class="even gradeA" v-for="item in order_list">
                        <td v-text="item.houseEntity.rooname"></td>
                        <td>
                            {{item.username}}
                            <span class="badge badge-warning" v-if="item.usersEntity.type == 1">普通用户</span>
                            <span class="badge badge-danger" v-if="item.usersEntity.type == 2">会员</span>
                        </td>
                        <td v-text="item.tel"></td>
                        <td v-text="item.sex"></td>
                        <td v-text="item.idcard"></td>
                        <td v-text="item.houseEntity.price" v-if="item.usersEntity.type == 1"></td>
                        <td v-text="item.houseEntity.price2" v-if="item.usersEntity.type == 2"></td>
                        <td v-text="item.indate + '~' + item.outdate"></td>
                        <td v-if="item.state == 1">待付款</td>
                        <td v-if="item.state == 2">待入住</td>
                        <td v-if="item.state == 3">已入住</td>
                        <td v-if="item.state == 4">已退房</td>
                        <td v-if="item.state == 2">
                            <a :href="'/apply/apply/state?ret=list&state=3&id=' + item.id">
                                <i class="icon-pencil"></i>
                                办理入住
                            </a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <!-- jQuery  -->
    <script src="/assets/js/jquery.min.js"></script>
    <script src="/assets/js/bootstrap.bundle.min.js"></script>
    <script src="/assets/js/metisMenu.min.js"></script>
    <script src="/assets/js/waves.min.js"></script>
    <script src="/assets/js/jquery.slimscroll.min.js"></script>

    <script src="/assets/plugins/jvectormap/jquery-jvectormap-2.0.2.min.js"></script>
    <script src="/assets/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>

    <script src="/assets/plugins/moment/moment.js"></script>
    <script src="/assets/plugins/apexcharts/apexcharts.min.js"></script>
    <script src="/assets/pages/jquery.dashboard.init.js"></script>
    <!-- App js -->
    <script src="/assets/js/app.js"></script>
    <script src="/source/scripts/window.js"></script>
    <script src="/source/js.js"></script>
    <script>
        $().ready(function () {
            $(".uploadImg").click(function () {
                openWindow("/upload.jsp");
            });
            $("#thumb").on("input", function () {
                $(".oldImg").attr("src", "/" + $("#thumb").val());
            });
        });
    </script>
    <script type="text/javascript">
        const baseUrl = "http://localhost:8080";
        let vm = new Vue({
            el: "#order_list_vue",
            data() {
                return {
                    order_list: []
                }
            },
            methods: {
                getDataList(){
                    /*
                    API：http://localhost:8080/hotel/apply/apply/get_order_list
                    */
                    axios({
                        method: "get",
                        url: baseUrl + "/hotel/apply/apply/get_order_list",
                        responseType: "json"
                    }).then(response => {
                        this.order_list = response.data.list;
                    }).catch(error => {
                       console.log("请求失败，失败信息：",error);
                   })
                }
            },
            created() {
                this.getDataList();
            }
        })
    </script>
</body>

</html>